﻿using UnityEngine;
namespace UGUIMan
{
    public class Feets:MonoBehaviour
    {
        Animator animator;
        public static float speedLeft=0,speedRight=0;
        public float speedleft;
        public float speedright;
        public static Vector3 angle=Vector3.zero;
        public static float speed
        {
            get { return speedLeft + speedRight; }
        }
        private void Awake()
        {
            animator = GetComponent<Animator>();
            animator.speed = speedLeft+speedRight;
        }
        public static void SpeedChange(string s ,float speed)
        {
            if (s == "Left")
            {
                speedLeft = speed/2;
            }
            else
            {
                speedRight = speed/2;
            }
        }
        public void Rotate(GameObject g)
        {
            float o;

            g.transform.rotation.ToAngleAxis(out o,out angle);
            transform.rotation = Quaternion.AngleAxis(o, angle);
            Debug.Log(angle);
        }
        private void Update()
        {
            animator.speed = speedLeft+speedRight;
            animator.Update(0.01f);
            speedleft = speedLeft;
            speedright = speedRight;
        }
    }
}